package com.wuxiaofan.coupon.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.coupon.entity.SmsHomeSubjectSpu;
import com.wuxiaofan.coupon.entity.custom.SmsHomeSubjectSpuCustom;
import com.wuxiaofan.coupon.mapper.SmsHomeSubjectSpuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.coupon.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SmsHomeSubjectSpuService {
    @Autowired
    private SmsHomeSubjectSpuMapper smsHomeSubjectSpuMapper;
    @Resource
    private Idgenerator idgenerator;
    public SmsHomeSubjectSpu findById(String id){
        return smsHomeSubjectSpuMapper.selectById(id);
    }

    public SmsHomeSubjectSpuCustom findCountByMap(Map paraMap){
        return smsHomeSubjectSpuMapper.findCountByMap(paraMap);
    }

    public SmsHomeSubjectSpuCustom findGroupByMap(Map paraMap){
        return smsHomeSubjectSpuMapper.findGroupByMap(paraMap);
    }

    public List<SmsHomeSubjectSpuCustom> findByMap(Map paraMap){
        return smsHomeSubjectSpuMapper.findByMap(paraMap);
    }

    public Page<SmsHomeSubjectSpuCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(smsHomeSubjectSpuMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        smsHomeSubjectSpuMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        smsHomeSubjectSpuMapper.deleteById(id);
    }

    public SmsHomeSubjectSpu save(SmsHomeSubjectSpu smsHomeSubjectSpu){
        smsHomeSubjectSpu.setId(idgenerator.getId());
        smsHomeSubjectSpuMapper.insert(smsHomeSubjectSpu);
        return smsHomeSubjectSpu;
    }

}
